package com.rajaev.dtu.tractor.domain.entity;

import com.rajaev.dtu.tractor.infrastructure.helper.SnotiHelper;
import lombok.Data;

@Data
public class DeviceFaultRecord {

    private static final int fault_timeout = 60 * 5;//单位秒

    private String code;

    private long faultRefreshTimestamp;

    /**
     * 判断该故障是否已经解除
     *
     * @return
     */
    public boolean isNotOver() {
        if(SnotiHelper.getSnotiTimestamp()==0){
            return true;
        }
        return SnotiHelper.getSnotiTimestamp() - faultRefreshTimestamp > fault_timeout;
    }

}
